<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>fullscreen.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_dom_fullscreen.js.html">fullscreen.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2012 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Functions for managing full screen status of the DOM.
<a name="line17"></a> *
<a name="line18"></a> */
<a name="line19"></a>
<a name="line20"></a>goog.provide(&#39;goog.dom.fullscreen&#39;);
<a name="line21"></a>goog.provide(&#39;goog.dom.fullscreen.EventType&#39;);
<a name="line22"></a>
<a name="line23"></a>goog.require(&#39;goog.dom&#39;);
<a name="line24"></a>goog.require(&#39;goog.userAgent&#39;);
<a name="line25"></a>
<a name="line26"></a>
<a name="line27"></a>/**
<a name="line28"></a> * Event types for full screen.
<a name="line29"></a> * @enum {string}
<a name="line30"></a> */
<a name="line31"></a>goog.dom.fullscreen.EventType = {
<a name="line32"></a>  /** Dispatched by the Document when the fullscreen status changes. */
<a name="line33"></a>  CHANGE: (function() {
<a name="line34"></a>    if (goog.userAgent.WEBKIT) {
<a name="line35"></a>      return &#39;webkitfullscreenchange&#39;;
<a name="line36"></a>    }
<a name="line37"></a>    if (goog.userAgent.GECKO) {
<a name="line38"></a>      return &#39;mozfullscreenchange&#39;;
<a name="line39"></a>    }
<a name="line40"></a>    if (goog.userAgent.IE) {
<a name="line41"></a>      return &#39;MSFullscreenChange&#39;;
<a name="line42"></a>    }
<a name="line43"></a>    // Opera 12-14, and W3C standard (Draft):
<a name="line44"></a>    // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
<a name="line45"></a>    return &#39;fullscreenchange&#39;;
<a name="line46"></a>  })()
<a name="line47"></a>};
<a name="line48"></a>
<a name="line49"></a>
<a name="line50"></a>/**
<a name="line51"></a> * Determines if full screen is supported.
<a name="line52"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line53"></a> *     queried. If not provided, use the current DOM.
<a name="line54"></a> * @return {boolean} True iff full screen is supported.
<a name="line55"></a> */
<a name="line56"></a>goog.dom.fullscreen.isSupported = function(opt_domHelper) {
<a name="line57"></a>  var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
<a name="line58"></a>  var body = doc.body;
<a name="line59"></a>  return !!(body.webkitRequestFullscreen ||
<a name="line60"></a>      (body.mozRequestFullScreen &amp;&amp; doc.mozFullScreenEnabled) ||
<a name="line61"></a>      (body.msRequestFullscreen &amp;&amp; doc.msFullscreenEnabled) ||
<a name="line62"></a>      (body.requestFullscreen &amp;&amp; doc.fullscreenEnabled));
<a name="line63"></a>};
<a name="line64"></a>
<a name="line65"></a>
<a name="line66"></a>/**
<a name="line67"></a> * Requests putting the element in full screen.
<a name="line68"></a> * @param {!Element} element The element to put full screen.
<a name="line69"></a> */
<a name="line70"></a>goog.dom.fullscreen.requestFullScreen = function(element) {
<a name="line71"></a>  if (element.webkitRequestFullscreen) {
<a name="line72"></a>    element.webkitRequestFullscreen();
<a name="line73"></a>  } else if (element.mozRequestFullScreen) {
<a name="line74"></a>    element.mozRequestFullScreen();
<a name="line75"></a>  } else if (element.msRequestFullscreen) {
<a name="line76"></a>    element.msRequestFullscreen();
<a name="line77"></a>  } else if (element.requestFullscreen) {
<a name="line78"></a>    element.requestFullscreen();
<a name="line79"></a>  }
<a name="line80"></a>};
<a name="line81"></a>
<a name="line82"></a>
<a name="line83"></a>/**
<a name="line84"></a> * Requests putting the element in full screen with full keyboard access.
<a name="line85"></a> * @param {!Element} element The element to put full screen.
<a name="line86"></a> */
<a name="line87"></a>goog.dom.fullscreen.requestFullScreenWithKeys = function(
<a name="line88"></a>    element) {
<a name="line89"></a>  if (element.mozRequestFullScreenWithKeys) {
<a name="line90"></a>    element.mozRequestFullScreenWithKeys();
<a name="line91"></a>  } else if (element.webkitRequestFullscreen) {
<a name="line92"></a>    element.webkitRequestFullscreen();
<a name="line93"></a>  } else {
<a name="line94"></a>    goog.dom.fullscreen.requestFullScreen(element);
<a name="line95"></a>  }
<a name="line96"></a>};
<a name="line97"></a>
<a name="line98"></a>
<a name="line99"></a>/**
<a name="line100"></a> * Exits full screen.
<a name="line101"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line102"></a> *     queried. If not provided, use the current DOM.
<a name="line103"></a> */
<a name="line104"></a>goog.dom.fullscreen.exitFullScreen = function(opt_domHelper) {
<a name="line105"></a>  var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
<a name="line106"></a>  if (doc.webkitCancelFullScreen) {
<a name="line107"></a>    doc.webkitCancelFullScreen();
<a name="line108"></a>  } else if (doc.mozCancelFullScreen) {
<a name="line109"></a>    doc.mozCancelFullScreen();
<a name="line110"></a>  } else if (doc.msExitFullscreen) {
<a name="line111"></a>    doc.msExitFullscreen();
<a name="line112"></a>  } else if (doc.exitFullscreen) {
<a name="line113"></a>    doc.exitFullscreen();
<a name="line114"></a>  }
<a name="line115"></a>};
<a name="line116"></a>
<a name="line117"></a>
<a name="line118"></a>/**
<a name="line119"></a> * Determines if the document is full screen.
<a name="line120"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line121"></a> *     queried. If not provided, use the current DOM.
<a name="line122"></a> * @return {boolean} Whether the document is full screen.
<a name="line123"></a> */
<a name="line124"></a>goog.dom.fullscreen.isFullScreen = function(opt_domHelper) {
<a name="line125"></a>  var doc = goog.dom.fullscreen.getDocument_(opt_domHelper);
<a name="line126"></a>  // IE 11 doesn&#39;t have similar boolean property, so check whether
<a name="line127"></a>  // document.msFullscreenElement is null instead.
<a name="line128"></a>  return !!(doc.webkitIsFullScreen || doc.mozFullScreen ||
<a name="line129"></a>      doc.msFullscreenElement || doc.fullscreenElement);
<a name="line130"></a>};
<a name="line131"></a>
<a name="line132"></a>
<a name="line133"></a>/**
<a name="line134"></a> * Gets the document object of the dom.
<a name="line135"></a> * @param {!goog.dom.DomHelper=} opt_domHelper The DomHelper for the DOM being
<a name="line136"></a> *     queried. If not provided, use the current DOM.
<a name="line137"></a> * @return {!Document} The dom document.
<a name="line138"></a> * @private
<a name="line139"></a> */
<a name="line140"></a>goog.dom.fullscreen.getDocument_ = function(opt_domHelper) {
<a name="line141"></a>  return opt_domHelper ?
<a name="line142"></a>      opt_domHelper.getDocument() :
<a name="line143"></a>      goog.dom.getDomHelper().getDocument();
<a name="line144"></a>};
</pre>


</body>
</html>
